﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TlToolCordCreate
{
    /// <summary>
    /// ucVue.xaml 的交互逻辑
    /// </summary>
    public partial class ucVue : UserControl
    {
        public ucVue()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var xmlCommentHelper = new XmlCommentHelper();
            xmlCommentHelper.LoadAll();

            Type type = typeof(CardList);
            var typeComment = xmlCommentHelper.GetTypeComment(type);
            Console.WriteLine($"{type.Name}的注释：{typeComment}");

            var fields = type.GetFields(bindingAttr: System.Reflection.BindingFlags.NonPublic);
            foreach (var field in fields)
            {
                var fieldComment = xmlCommentHelper.GetFieldOrPropertyComment(field);
                Console.WriteLine($"{field.Name}字段的注释：{fieldComment}");
            }

            var properties = type.GetProperties();
            foreach (var property in properties)
            {
                var propertyComment = xmlCommentHelper.GetFieldOrPropertyComment(property);
                Console.WriteLine($"{property.Name}属性的注释：{propertyComment}");
            }


        }
    }
}
